package ms.unicorn.dsl;

import java.net.URL;
import java.util.Collection;
import java.util.List;

import ms.unicorn.Element;
import ms.unicorn.Relation;
import ms.unicorn.dsl.unicornDSL.LanguageElement;

import org.eclipse.draw2d.IFigure;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.resource.ImageDescriptor;

public interface ILanguageElement extends ILanguageObject, LanguageElement {
	
	int getObjectType();

	IElementType getIElementType();

	String getTooltip();

	IEditHelperAdviceEx getAdvisor();

	IModelLanguage getLanguage();
	
	IElementField getField(String name);
	
	Collection<IElementField> getFields();

	Class<?> getElementClass();

	EClass getElementEClass();

	List<IItemPropertyDescriptor> getPropertyDescriptors(ComposeableAdapterFactory composeableAdapterFactory,
						ResourceLocator resourceLocator, List<IItemPropertyDescriptor> list);

	View createView(View containerView, Element domainElement, PreferencesHint preferencesHint);

	IFigure createFigure(Element domainElement, EditPart entityEditPart);

	EditPart createEditPart(View view);

	boolean checkRelationConstraints(Element element, Relation linkInstance, Element source, Element target);

	void createDefaultEditPolicies(IGraphicalEditPart editPart,	Element domainElement);

	EditPolicy createPrimaryDragEditPolicy(Element element, IGraphicalEditPart entityEditPart);

	void configElement(Element element);

	List<IElementType> getContainableTypes();
	
	URL getIconURL();
	
	URL getLargeIconURL();

	ImageDescriptor getSmallImage();

	ImageDescriptor getLargeImage();

	List<IElementType> getMARelTypesOnSource(IGraphicalEditPart editPart);

	List<IElementType> getMARelTypesOnSourceAndTarget(
			IGraphicalEditPart entityEditPart, IGraphicalEditPart targetEditPart,
			ILanguageElement tar);

	List<IElementType> getMATypesForTarget(IGraphicalEditPart entityEditPart,
			HintedSpecializationType relationshipType);

	List<IElementType> getMARelTypesOnTarget(IGraphicalEditPart entityEditPart);

	boolean canConnect(ILanguageElement source, ILanguageElement target);
}
